package b.s.a.a;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ArgbEvaluator;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.PorterDuff.Mode;
import android.graphics.Rect;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.Callback;
import android.graphics.drawable.Drawable.ConstantState;
import android.os.Build.VERSION;
import android.util.AttributeSet;
import b.i.b.f;
import java.io.IOException;
import java.util.ArrayList;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

/* compiled from: AnimatedVectorDrawableCompat */
public class b extends e implements Animatable {
    public b b;
    public Context c;
    public ArgbEvaluator d;
    public final Callback e;

    /* compiled from: AnimatedVectorDrawableCompat */
    public class a implements Callback {
        public void invalidateDrawable(Drawable drawable) {
            b.this.invalidateSelf();
        }

        public void scheduleDrawable(Drawable drawable, Runnable runnable, long j) {
            b.this.scheduleSelf(runnable, j);
        }

        public void unscheduleDrawable(Drawable drawable, Runnable runnable) {
            b.this.unscheduleSelf(runnable);
        }
    }

    /* compiled from: AnimatedVectorDrawableCompat */
    public static class b extends ConstantState {
        public int a;
        public f b;
        public AnimatorSet c;
        public ArrayList<Animator> d;
        public b.f.a<Animator, String> e;

        public b(b bVar, Callback callback, Resources resources) {
            if (bVar != null) {
                this.a = bVar.a;
                f fVar = bVar.b;
                int i = 0;
                if (fVar != null) {
                    ConstantState constantState = fVar.getConstantState();
                    if (resources != null) {
                        this.b = (f) constantState.newDrawable(resources);
                    } else {
                        this.b = (f) constantState.newDrawable();
                    }
                    f fVar2 = this.b;
                    fVar2.mutate();
                    this.b = fVar2;
                    fVar2.setCallback(callback);
                    this.b.setBounds(bVar.b.getBounds());
                    this.b.f = false;
                }
                ArrayList arrayList = bVar.d;
                if (arrayList != null) {
                    int size = arrayList.size();
                    this.d = new ArrayList(size);
                    this.e = new b.f.a(size);
                    while (i < size) {
                        Animator animator = (Animator) bVar.d.get(i);
                        Animator clone = animator.clone();
                        String str = (String) bVar.e.getOrDefault(animator, null);
                        clone.setTarget(this.b.b.b.p.getOrDefault(str, null));
                        this.d.add(clone);
                        this.e.put(clone, str);
                        i++;
                    }
                    if (this.c == null) {
                        this.c = new AnimatorSet();
                    }
                    this.c.playTogether(this.d);
                }
            }
        }

        public int getChangingConfigurations() {
            return this.a;
        }

        public Drawable newDrawable() {
            throw new IllegalStateException("No constant state support for SDK < 24.");
        }

        public Drawable newDrawable(Resources resources) {
            throw new IllegalStateException("No constant state support for SDK < 24.");
        }
    }

    /* compiled from: AnimatedVectorDrawableCompat */
    public static class c extends ConstantState {
        public final ConstantState a;

        public c(ConstantState constantState) {
            this.a = constantState;
        }

        public boolean canApplyTheme() {
            return this.a.canApplyTheme();
        }

        public int getChangingConfigurations() {
            return this.a.getChangingConfigurations();
        }

        public Drawable newDrawable() {
            b bVar = new b(null, null, null);
            Drawable newDrawable = this.a.newDrawable();
            bVar.a = newDrawable;
            newDrawable.setCallback(bVar.e);
            return bVar;
        }

        public Drawable newDrawable(Resources resources) {
            b bVar = new b(null, null, null);
            Drawable newDrawable = this.a.newDrawable(resources);
            bVar.a = newDrawable;
            newDrawable.setCallback(bVar.e);
            return bVar;
        }

        public Drawable newDrawable(Resources resources, Theme theme) {
            b bVar = new b(null, null, null);
            Drawable newDrawable = this.a.newDrawable(resources, theme);
            bVar.a = newDrawable;
            newDrawable.setCallback(bVar.e);
            return bVar;
        }
    }

    public b() {
        this(null, null, null);
    }

    public void applyTheme(Theme theme) {
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.applyTheme(theme);
        }
    }

    public boolean canApplyTheme() {
        Drawable drawable = this.a;
        return drawable != null ? drawable.canApplyTheme() : false;
    }

    public void draw(Canvas canvas) {
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.draw(canvas);
            return;
        }
        this.b.b.draw(canvas);
        if (this.b.c.isStarted()) {
            invalidateSelf();
        }
    }

    public int getAlpha() {
        Drawable drawable = this.a;
        if (drawable != null) {
            return drawable.getAlpha();
        }
        return this.b.b.getAlpha();
    }

    public int getChangingConfigurations() {
        Drawable drawable = this.a;
        if (drawable != null) {
            return drawable.getChangingConfigurations();
        }
        return super.getChangingConfigurations() | this.b.a;
    }

    public ColorFilter getColorFilter() {
        Drawable drawable = this.a;
        if (drawable != null) {
            return drawable.getColorFilter();
        }
        return this.b.b.getColorFilter();
    }

    public ConstantState getConstantState() {
        return (this.a == null || VERSION.SDK_INT < 24) ? null : new c(this.a.getConstantState());
    }

    public int getIntrinsicHeight() {
        Drawable drawable = this.a;
        if (drawable != null) {
            return drawable.getIntrinsicHeight();
        }
        return this.b.b.getIntrinsicHeight();
    }

    public int getIntrinsicWidth() {
        Drawable drawable = this.a;
        if (drawable != null) {
            return drawable.getIntrinsicWidth();
        }
        return this.b.b.getIntrinsicWidth();
    }

    public int getOpacity() {
        Drawable drawable = this.a;
        if (drawable != null) {
            return drawable.getOpacity();
        }
        return this.b.b.getOpacity();
    }

    /* JADX WARNING: Removed duplicated region for block: B:91:0x0080 A:{SYNTHETIC} */
    /* JADX WARNING: Removed duplicated region for block: B:26:0x007b A:{Catch:{ XmlPullParserException -> 0x008d, IOException -> 0x0088 }} */
    /* JADX WARNING: Removed duplicated region for block: B:36:0x009f  */
    /* JADX WARNING: Removed duplicated region for block: B:36:0x009f  */
    /* JADX WARNING: Removed duplicated region for block: B:77:0x0178  */
    /* JADX WARNING: Removed duplicated region for block: B:77:0x0178  */
    public void inflate(android.content.res.Resources r25, org.xmlpull.v1.XmlPullParser r26, android.util.AttributeSet r27, android.content.res.Resources.Theme r28) throws org.xmlpull.v1.XmlPullParserException, java.io.IOException {
        /*
        r24 = this;
        r1 = r24;
        r2 = r25;
        r3 = r27;
        r4 = r28;
        r5 = android.os.Build.VERSION.SDK_INT;
        r0 = r1.a;
        if (r0 == 0) goto L_0x0014;
    L_0x000e:
        r6 = r26;
        r0.inflate(r2, r6, r3, r4);
        return;
    L_0x0014:
        r6 = r26;
        r0 = r26.getEventType();
        r7 = r26.getDepth();
        r8 = 1;
        r7 = r7 + r8;
    L_0x0020:
        if (r0 == r8) goto L_0x0190;
    L_0x0022:
        r9 = r26.getDepth();
        if (r9 >= r7) goto L_0x002b;
    L_0x0028:
        r9 = 3;
        if (r0 == r9) goto L_0x0190;
    L_0x002b:
        r9 = 2;
        if (r0 != r9) goto L_0x018a;
    L_0x002e:
        r0 = r26.getName();
        r10 = "animated-vector";
        r10 = r10.equals(r0);
        r11 = 24;
        r12 = 0;
        if (r10 == 0) goto L_0x00ac;
    L_0x003d:
        r0 = b.s.a.a.a.e;
        r10 = b.i.c.b.h.e(r2, r4, r3, r0);
        r0 = r10.getResourceId(r12, r12);
        if (r0 == 0) goto L_0x00a7;
    L_0x0049:
        r14 = b.s.a.a.f.j;
        r14 = "parser error";
        r15 = "VectorDrawableCompat";
        if (r5 < r11) goto L_0x0068;
    L_0x0051:
        r9 = new b.s.a.a.f;
        r9.m7878init();
        r0 = r2.getDrawable(r0, r4);
        r9.a = r0;
        r0 = new b.s.a.a.f$i;
        r11 = r9.a;
        r11 = r11.getConstantState();
        r0.m690init(r11);
        goto L_0x0092;
    L_0x0068:
        r0 = r2.getXml(r0);	 Catch:{ XmlPullParserException -> 0x008d, IOException -> 0x0088 }
        r11 = android.util.Xml.asAttributeSet(r0);	 Catch:{ XmlPullParserException -> 0x008d, IOException -> 0x0088 }
    L_0x0070:
        r13 = r0.next();	 Catch:{ XmlPullParserException -> 0x008d, IOException -> 0x0088 }
        if (r13 == r9) goto L_0x0079;
    L_0x0076:
        if (r13 == r8) goto L_0x0079;
    L_0x0078:
        goto L_0x0070;
    L_0x0079:
        if (r13 != r9) goto L_0x0080;
    L_0x007b:
        r9 = b.s.a.a.f.a(r2, r0, r11, r4);	 Catch:{ XmlPullParserException -> 0x008d, IOException -> 0x0088 }
        goto L_0x0092;
    L_0x0080:
        r0 = new org.xmlpull.v1.XmlPullParserException;	 Catch:{ XmlPullParserException -> 0x008d, IOException -> 0x0088 }
        r9 = "No start tag found";
        r0.<init>(r9);	 Catch:{ XmlPullParserException -> 0x008d, IOException -> 0x0088 }
        throw r0;	 Catch:{ XmlPullParserException -> 0x008d, IOException -> 0x0088 }
    L_0x0088:
        r0 = move-exception;
        android.util.Log.e(r15, r14, r0);
        goto L_0x0091;
    L_0x008d:
        r0 = move-exception;
        android.util.Log.e(r15, r14, r0);
    L_0x0091:
        r9 = 0;
    L_0x0092:
        r9.f = r12;
        r0 = r1.e;
        r9.setCallback(r0);
        r0 = r1.b;
        r0 = r0.b;
        if (r0 == 0) goto L_0x00a3;
    L_0x009f:
        r11 = 0;
        r0.setCallback(r11);
    L_0x00a3:
        r0 = r1.b;
        r0.b = r9;
    L_0x00a7:
        r10.recycle();
        goto L_0x018a;
    L_0x00ac:
        r9 = "target";
        r0 = r9.equals(r0);
        if (r0 == 0) goto L_0x018a;
    L_0x00b4:
        r0 = b.s.a.a.a.f;
        r0 = r2.obtainAttributes(r3, r0);
        r9 = r0.getString(r12);
        r10 = r0.getResourceId(r8, r12);
        if (r10 == 0) goto L_0x0187;
    L_0x00c4:
        r12 = r1.c;
        if (r12 == 0) goto L_0x017c;
    L_0x00c8:
        if (r5 < r11) goto L_0x00cf;
    L_0x00ca:
        r10 = android.animation.AnimatorInflater.loadAnimator(r12, r10);
        goto L_0x00f4;
    L_0x00cf:
        r11 = r12.getResources();
        r18 = r12.getTheme();
        r13 = "Can't load animation resource ID #0x";
        r14 = r11.getAnimation(r10);	 Catch:{ XmlPullParserException -> 0x0155, IOException -> 0x0137, all -> 0x0133 }
        r20 = android.util.Xml.asAttributeSet(r14);	 Catch:{ XmlPullParserException -> 0x0130, IOException -> 0x012d, all -> 0x012b }
        r21 = 0;
        r22 = 0;
        r23 = 1065353216; // 0x3f800000 float:1.0 double:5.263544247E-315;
        r16 = r12;
        r17 = r11;
        r19 = r14;
        r10 = b.s.a.a.c.a(r16, r17, r18, r19, r20, r21, r22, r23);	 Catch:{ XmlPullParserException -> 0x0130, IOException -> 0x012d, all -> 0x012b }
        r14.close();
    L_0x00f4:
        r11 = r1.b;
        r11 = r11.b;
        r11 = r11.b;
        r11 = r11.b;
        r11 = r11.p;
        r12 = 0;
        r11 = r11.getOrDefault(r9, r12);
        r10.setTarget(r11);
        r11 = r1.b;
        r12 = r11.d;
        if (r12 != 0) goto L_0x011c;
    L_0x010c:
        r12 = new java.util.ArrayList;
        r12.<init>();
        r11.d = r12;
        r11 = r1.b;
        r12 = new b.f.a;
        r12.m5038init();
        r11.e = r12;
    L_0x011c:
        r11 = r1.b;
        r11 = r11.d;
        r11.add(r10);
        r11 = r1.b;
        r11 = r11.e;
        r11.put(r10, r9);
        goto L_0x0187;
    L_0x012b:
        r0 = move-exception;
        goto L_0x0176;
    L_0x012d:
        r0 = move-exception;
        r12 = r14;
        goto L_0x0139;
    L_0x0130:
        r0 = move-exception;
        r12 = r14;
        goto L_0x0157;
    L_0x0133:
        r0 = move-exception;
        r12 = 0;
    L_0x0135:
        r13 = r12;
        goto L_0x0175;
    L_0x0137:
        r0 = move-exception;
        r12 = 0;
    L_0x0139:
        r2 = new android.content.res.Resources$NotFoundException;	 Catch:{ all -> 0x0173 }
        r3 = new java.lang.StringBuilder;	 Catch:{ all -> 0x0173 }
        r3.<init>();	 Catch:{ all -> 0x0173 }
        r3.append(r13);	 Catch:{ all -> 0x0173 }
        r4 = java.lang.Integer.toHexString(r10);	 Catch:{ all -> 0x0173 }
        r3.append(r4);	 Catch:{ all -> 0x0173 }
        r3 = r3.toString();	 Catch:{ all -> 0x0173 }
        r2.<init>(r3);	 Catch:{ all -> 0x0173 }
        r2.initCause(r0);	 Catch:{ all -> 0x0173 }
        throw r2;	 Catch:{ all -> 0x0173 }
    L_0x0155:
        r0 = move-exception;
        r12 = 0;
    L_0x0157:
        r2 = new android.content.res.Resources$NotFoundException;	 Catch:{ all -> 0x0173 }
        r3 = new java.lang.StringBuilder;	 Catch:{ all -> 0x0173 }
        r3.<init>();	 Catch:{ all -> 0x0173 }
        r3.append(r13);	 Catch:{ all -> 0x0173 }
        r4 = java.lang.Integer.toHexString(r10);	 Catch:{ all -> 0x0173 }
        r3.append(r4);	 Catch:{ all -> 0x0173 }
        r3 = r3.toString();	 Catch:{ all -> 0x0173 }
        r2.<init>(r3);	 Catch:{ all -> 0x0173 }
        r2.initCause(r0);	 Catch:{ all -> 0x0173 }
        throw r2;	 Catch:{ all -> 0x0173 }
    L_0x0173:
        r0 = move-exception;
        goto L_0x0135;
    L_0x0175:
        r14 = r13;
    L_0x0176:
        if (r14 == 0) goto L_0x017b;
    L_0x0178:
        r14.close();
    L_0x017b:
        throw r0;
    L_0x017c:
        r0.recycle();
        r0 = new java.lang.IllegalStateException;
        r2 = "Context can't be null when inflating animators";
        r0.<init>(r2);
        throw r0;
    L_0x0187:
        r0.recycle();
    L_0x018a:
        r0 = r26.next();
        goto L_0x0020;
    L_0x0190:
        r0 = r1.b;
        r2 = r0.c;
        if (r2 != 0) goto L_0x019d;
    L_0x0196:
        r2 = new android.animation.AnimatorSet;
        r2.<init>();
        r0.c = r2;
    L_0x019d:
        r2 = r0.c;
        r0 = r0.d;
        r2.playTogether(r0);
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: b.s.a.a.b.inflate(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources$Theme):void");
    }

    public boolean isAutoMirrored() {
        Drawable drawable = this.a;
        if (drawable != null) {
            return drawable.isAutoMirrored();
        }
        return this.b.b.isAutoMirrored();
    }

    public boolean isRunning() {
        Drawable drawable = this.a;
        if (drawable != null) {
            return ((AnimatedVectorDrawable) drawable).isRunning();
        }
        return this.b.c.isRunning();
    }

    public boolean isStateful() {
        Drawable drawable = this.a;
        if (drawable != null) {
            return drawable.isStateful();
        }
        return this.b.b.isStateful();
    }

    public Drawable mutate() {
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.mutate();
        }
        return this;
    }

    public void onBoundsChange(Rect rect) {
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.setBounds(rect);
        } else {
            this.b.b.setBounds(rect);
        }
    }

    public boolean onLevelChange(int i) {
        Drawable drawable = this.a;
        if (drawable != null) {
            return drawable.setLevel(i);
        }
        return this.b.b.setLevel(i);
    }

    public boolean onStateChange(int[] iArr) {
        Drawable drawable = this.a;
        if (drawable != null) {
            return drawable.setState(iArr);
        }
        return this.b.b.setState(iArr);
    }

    public void setAlpha(int i) {
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.setAlpha(i);
        } else {
            this.b.b.setAlpha(i);
        }
    }

    public void setAutoMirrored(boolean z) {
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.setAutoMirrored(z);
            return;
        }
        f fVar = this.b.b;
        Drawable drawable2 = fVar.a;
        if (drawable2 != null) {
            drawable2.setAutoMirrored(z);
        } else {
            fVar.b.e = z;
        }
    }

    public void setColorFilter(ColorFilter colorFilter) {
        Drawable drawable = this.a;
        if (drawable != null) {
            drawable.setColorFilter(colorFilter);
            return;
        }
        f fVar = this.b.b;
        Drawable drawable2 = fVar.a;
        if (drawable2 != null) {
            drawable2.setColorFilter(colorFilter);
        } else {
            fVar.d = colorFilter;
            fVar.invalidateSelf();
        }
    }

    public void setTint(int i) {
        Drawable drawable = this.a;
        if (drawable != null) {
            f.c1(drawable, i);
        } else {
            this.b.b.setTint(i);
        }
    }

    public void setTintList(ColorStateList colorStateList) {
        Drawable drawable = this.a;
        if (drawable != null) {
            f.d1(drawable, colorStateList);
        } else {
            this.b.b.setTintList(colorStateList);
        }
    }

    public void setTintMode(Mode mode) {
        Drawable drawable = this.a;
        if (drawable != null) {
            f.e1(drawable, mode);
        } else {
            this.b.b.setTintMode(mode);
        }
    }

    public boolean setVisible(boolean z, boolean z2) {
        Drawable drawable = this.a;
        if (drawable != null) {
            return drawable.setVisible(z, z2);
        }
        this.b.b.setVisible(z, z2);
        return super.setVisible(z, z2);
    }

    public void start() {
        Drawable drawable = this.a;
        if (drawable != null) {
            ((AnimatedVectorDrawable) drawable).start();
        } else if (!this.b.c.isStarted()) {
            this.b.c.start();
            invalidateSelf();
        }
    }

    public void stop() {
        Drawable drawable = this.a;
        if (drawable != null) {
            ((AnimatedVectorDrawable) drawable).stop();
        } else {
            this.b.c.end();
        }
    }

    public b(Context context, b bVar, Resources resources) {
        this.d = null;
        a aVar = new a();
        this.e = aVar;
        this.c = context;
        this.b = new b(null, aVar, null);
    }

    public void inflate(Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet) throws XmlPullParserException, IOException {
        inflate(resources, xmlPullParser, attributeSet, null);
    }
}
